using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using NiSis.Entities;

namespace NiSis
{
    public partial class DeconsolidatedRelationShips : System.Web.UI.Page
    {
        int IdBatch;
        public SshStatoRelazioniList Stato
        {
            get
            {
                int st;
                int.TryParse(hdStato.Value, out st);
                return (SshStatoRelazioniList) st;
            }
            set
            {
                hdStato.Value = ((int)value).ToString();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                int.TryParse(Request["IdBatch"] ?? string.Empty, out IdBatch);
                RelationshipPicker1.LoadOldBatch(IdBatch);
                Stato = (SshStatoRelazioniList)(int.Parse(Request["stato"] ?? string.Empty));
            }

        }

        protected void cmdSave_Click(object sender, EventArgs e)
        {
            // todo, passare lo stato del batch che si modifica alla funzione.........
            RelationshipPicker1.SaveOld(Stato);
            Response.Redirect("Deconsolidamento.aspx");
        }
        protected void cmdCancel_Click(object sender, EventArgs e)
        {
            Response.Redirect("Deconsolidamento.aspx");
        }
    }
}
